#ifndef _HP5804_H_
#define _HP5804_H_

/* Includes ----------------------------------------------------------*/
#include <stdint.h>
#include <stdbool.h>
/* define ------------------------------------------------------------*/
#define HP5804_CMD_SOFT_RST     0x06
#define HP5804_CMD_ADC_CVT      0x40
#define HP5804_CMD_READ_PT      0x10
#define HP5804_CMD_READ_P       0x30
#define HP5804_CMD_READ_T       0x32
#define HP5804_CMD_ANA_CAL      0x28
#define HP5804_CMD_READ_REG     0x80
#define HP5804_CMD_WRITE_REG    0xC0

#define HP5804_CONFIG_CHL_PT    0x0
#define HP5804_CONFIG_CHL_T     0x02

#define HP5804_CONFIG_OSR_4096  (0)   
#define HP5804_CONFIG_OSR_2048  (0x01<<2)
#define HP5804_CONFIG_OSR_1024  (0x02<<2)
#define HP5804_CONFIG_OSR_512   (0x03<<2)
#define HP5804_CONFIG_OSR_256   (0x04<<2)
#define HP5804_CONFIG_OSR_128   (0x05<<2)

/* typedef -----------------------------------------------------------*/
struct Hp5804
{
    struct SoftI2c  *i2c;
    uint8_t         devAddress;             // �豸��ַ
    
    float pressure;                         // ѹ��
    float temperature;                      // �¶�
};

/* macro -------------------------------------------------------------*/
/* variables ---------------------------------------------------------*/
/* function prototypes -----------------------------------------------*/
int Hp5804_Init(struct Hp5804 *hp5804, uint32_t config);
int Hp5804_ReadData(struct Hp5804 *hp5804);

#endif
